<!DOCTYPE html>
<html class="no-js" lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>Linux - home</title>
	<script>(function(d,e){d[e]=d[e].replace("no-js","js");})(document.documentElement,"className");</script>
	<meta name="description" content="">
	<meta name="generator" content="Hugo 0.54.0" />
	<meta property="og:title" content="Linux" />
<meta property="og:description" content="pdc&#39;s Personal blog about something" />
<meta property="og:type" content="website" />
<meta property="og:url" content="/categories/linux/" />

<meta property="og:updated_time" content="2019-04-15T00:00:00&#43;00:00"/>

	
	<link rel="dns-prefetch" href="//fonts.googleapis.com">
	<link rel="dns-prefetch" href="//fonts.gstatic.com">
	<link rel="alternate" type="application/rss+xml" href="/categories/linux/index.xml" title="home">
	<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700">
	<link rel="stylesheet" href="/css/style.css">
	<link rel="stylesheet" href="/css/custom.css">
	<link rel="shortcut icon" href="/favicon.ico">
		
</head>
<body class="body">
	<div class="container container--outer">
		<header class="header">
	<div class="container">
		<div class="logo">
			<a class="logo__link" href="/" title="home" rel="home">
				<div class="logo__title">home</div>
				
			</a>
		</div>
		
<nav class="menu">
	<button class="menu__btn" aria-haspopup="true" aria-expanded="false" tabindex="0">
		<span class="menu__btn-title" tabindex="-1">Menu</span>
	</button>
	<ul class="menu__list">
		<li class="menu__item">
			<a class="menu__link" href="/about/">about</a>
		</li>
		<li class="menu__item">
			<a class="menu__link" href="/post/2020-05-26-%E6%90%9C%E7%B4%A2%E6%8A%80%E5%B7%A7/">搜索技巧</a>
		</li>
		<li class="menu__item">
			<a class="menu__link" href="/post/2019-04-13-vim%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/">vim常规使用</a>
		</li>
		<li class="menu__item">
			<a class="menu__link" href="/post/2020-05-21-%E5%AD%A6%E4%B9%A0%E5%9B%BE/">学习图</a>
		</li>
	</ul>
</nav>

	</div>
</header>
		<div class="wrapper flex">
			<div class="primary">
			
<main class="main list" role="main">
	<header class="main__header">
		<h1 class="main__title">Linux</h1>
	</header><article class="list__item post">
	<header class="list__header">
		<h3 class="list__title post__title ">
			<a href="/post/2019-04-14-awk%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/" rel="bookmark">
			awk常规使用
			</a>
		</h3>
		<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
	<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
	<time class="meta__text" datetime="2019-04-15T00:00:00">2019-04-15</time>
</div>

<div class="meta__item-categories meta__item">
	<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
	<span class="meta__text"><a class="meta__link" href="/categories/linux" rel="category">linux</a></span>
</div>
</div>
	</header>
	<div class="content list__excerpt post__content clearfix">
		参考coolshell：https://coolshell.cn/articles/9070.html
参考《sed与awk第二版》
 awk能完成的一些功能  将文本文件看作是由记录跟字段组成的文本数据库 使用变量操作数据库 使用算数和字符串操作符 使用普通的程序设计结构，如循环和条件 生成格式化报告 定义函数 从脚本中执行Unix命令 处理Unix命令的结果 更加巧妙的处理命令行的参数 更容易的处理多个输入流  内建变量    $0 该行记录(所有列)     \$1 - $n 第几列，由FS分割   FS 分割列的符号，默认空格或tab   NF 列数   NR 总行数，如是多个文件则为所有文件累加   FNR 各文件行数   RS 每行记录的分隔符，默认为换行   OFS 输出字段分隔符，默认空格   ORS 输出的记录分隔符，默认换行   FILENAME 文件名称    操作示例 # 打印第1、第2列 netstat -nat | head -n 20 | awk '{print $1,$2}' # 匹配第4列为字符串&quot;tcp4&quot;并且第6列为字符串&quot;LISTEN&quot;，或条件为`|`，其他运算符&quot;!
	</div>
	<div class="list__footer clearfix">
		<a class="list__footer-readmore btn" href="/post/2019-04-14-awk%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/">Read more…</a>
	</div>
</article><article class="list__item post">
	<header class="list__header">
		<h3 class="list__title post__title ">
			<a href="/post/2019-04-13-vim%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/" rel="bookmark">
			vim常规使用
			</a>
		</h3>
		<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
	<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
	<time class="meta__text" datetime="2019-04-13T00:00:00">2019-04-13</time>
</div>

<div class="meta__item-categories meta__item">
	<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
	<span class="meta__text"><a class="meta__link" href="/categories/linux" rel="category">linux</a></span>
</div>
</div>
	</header>
	<div class="content list__excerpt post__content clearfix">
		参考coolshell：https://coolshell.cn/articles/5426.html
vim tutorial：vimtutor
 基础操作  i、a - 光标处、后插入 o、O - 光标行后、前一行插入 x - 删除光标后一个字符 r、R - 替换一个、多个字符 dd - 删除当前行 p - 粘贴 yy - 拷贝当前行 u - undo ctrl + r - redo ctrl + b、ctrl + f - 上一页、下一页 ctrl + u、ctrl + d - 上半页、下半页 ctrl + y、ctrl + e - 向上、下滚动一行 :s /old/new 、:s /old/new/g- 当前行第一个、所有old字符换为new字符 :% s/old/new/g - 整个文件替换字符old为new esc - 退出编辑模式，回到normal模式  光标移动  hjkl - 分别对应←↓↑→ w、W - 到下一个单词开头，W到下一个单词（遇到blank后）开头 e、E - 到单词结尾，E到单词（直到遇到blank）结尾 b、B - 到单词开头，B到单词（直到遇到blank）开头 0 - 回行头 ^|_ - 到非blank字符行头 +和- - 移动到下一行开头、上一行开头 $ - 到行尾 g_ - 到非blank字符行尾 gg|1G|:1 - 回到文件第一行 G - 到文件最尾一行 NG|:N|Ngg - 到第N行 *、# - 匹配光标当前单词上一个(#)和下一个(*) % - 括号间移动，匹配(){}[]，需把光标放到括号上 fh - 移动光标到下一个字符为h的地方，Nfh为下N个 th - 移动光标到下一个字符为h的前一个字符，Nth为下N个 z - 将光标行移动到屏幕顶端 z.
	</div>
	<div class="list__footer clearfix">
		<a class="list__footer-readmore btn" href="/post/2019-04-13-vim%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/">Read more…</a>
	</div>
</article><article class="list__item post">
	<header class="list__header">
		<h3 class="list__title post__title ">
			<a href="/post/2018-09-23-rinetd-%E8%BD%AC%E5%8F%91/" rel="bookmark">
			rinetd转发
			</a>
		</h3>
		<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
	<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
	<time class="meta__text" datetime="2018-09-23T00:00:00">2018-09-23</time>
</div>

<div class="meta__item-categories meta__item">
	<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
	<span class="meta__text"><a class="meta__link" href="/categories/linux" rel="category">linux</a></span>
</div>
</div>
	</header>
	<div class="content list__excerpt post__content clearfix">
		安装依赖库 yum -y install gcc automake autoconf libtool make
安装 cat &gt;&gt; rinetd-installer.sh &lt;&lt;'EOF' #!/bin/bash wget http://www.boutell.com/rinetd/http/rinetd.tar.gz tar zxvf rinetd.tar.gz cd rinetd mkdir -p /usr/man/man8 make &amp;&amp; make install EOF chmod +x rinetd-installer.sh ./rinetd-installer.sh  配置 rm -f /etc/rinetd.conf cat &gt;&gt; /etc/rinetd.conf &lt;&lt;EOF # 设置允许访问的ip地址信息 allow 192.168.1.* # 设置日志文件路径 # logfile /var/log/rinetd.log # 例子: 将本机 8080 端口重定向至 www.baidu.com 的 80 端口 # 0.0.0.0 8080 www.baidu.com 80 EOF  启动 cat &gt;&gt; /etc/init.
	</div>
	<div class="list__footer clearfix">
		<a class="list__footer-readmore btn" href="/post/2018-09-23-rinetd-%E8%BD%AC%E5%8F%91/">Read more…</a>
	</div>
</article><article class="list__item post">
	<header class="list__header">
		<h3 class="list__title post__title ">
			<a href="/post/2018-09-21-centos%E5%8D%87%E7%BA%A7%E5%86%85%E6%A0%B8/" rel="bookmark">
			centos升级内核
			</a>
		</h3>
		<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
	<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
	<time class="meta__text" datetime="2018-09-21T00:00:00">2018-09-21</time>
</div>

<div class="meta__item-categories meta__item">
	<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
	<span class="meta__text"><a class="meta__link" href="/categories/linux" rel="category">linux</a></span>
</div>
</div>
	</header>
	<div class="content list__excerpt post__content clearfix">
		升级centos系统内核 https://www.howtoforge.com/tutorial/how-to-upgrade-kernel-in-centos-7-server/
# ==== 查看信息 ==== # step 1 yum -y update # 安装镜像插件，加速下载 yum -y install yum-plugin-fastestmirror # step 2 # 查看centos版本 cat /etc/redhat-release cat /etc/os-release # 查看主机详情 uname -a # ==== 主要 ==== # step 3 # 添加镜像源地址 rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm yum repolist # step 4 # 开启新加的elrepo-kernel源可用，并安装内核 yum -y --enablerepo=elrepo-kernel install kernel-ml # 查看源列表 yum repolist all # step 5 # 查看有多少个版本内核 sudo awk -F\' '$1==&quot;menuentry &quot; {print i++ &quot; : &quot; $2}' /etc/grub2.
	</div>
	<div class="list__footer clearfix">
		<a class="list__footer-readmore btn" href="/post/2018-09-21-centos%E5%8D%87%E7%BA%A7%E5%86%85%E6%A0%B8/">Read more…</a>
	</div>
</article><article class="list__item post">
	<header class="list__header">
		<h3 class="list__title post__title ">
			<a href="/post/2018-09-23-linux%E7%94%A8%E6%88%B7%E7%9B%B8%E5%85%B3%E5%9F%BA%E7%A1%80/" rel="bookmark">
			linux用户相关基础
			</a>
		</h3>
		<div class="list__meta meta">
<div class="meta__item-datetime meta__item">
	<svg class="meta__icon icon icon-time" width="16" height="14" viewBox="0 0 30 28"><path d="M15 0C7 0 1 6 1 14s6 14 14 14 14-6 14-14S23 0 15 0zm0 25C9 25 4 20 4 14S9 3 15 3s11 5 11 11-5 11-11 11zm1-18h-2v8.4l6.8 4.4L22 18l-6-3.8V7z"/></svg>
	<time class="meta__text" datetime="2018-09-21T00:00:00">2018-09-21</time>
</div>

<div class="meta__item-categories meta__item">
	<svg class="meta__icon icon icon-category" width="16" height="16" viewBox="0 0 16 16"><path d="m7 2l1 2h8v11h-16v-13z"/></svg>
	<span class="meta__text"><a class="meta__link" href="/categories/linux" rel="category">linux</a></span>
</div>
</div>
	</header>
	<div class="content list__excerpt post__content clearfix">
		相关命令  useradd 添加用户 usermod 修改用户 userdel 删除用户 passwd 修改用户密码 groupadd 添加用户组 groupmod 更改用户组 groupdel 删除用户组 chmod 改变文件的权限, SUID, SGID, SBIT等等的特性 chgrp 改变文件所属群组 chown 改变文件拥有者 groups 查看自己在什么群组 newgrp 切换群组  准备  用docker起一个ssh服务端 docker run -d --name ssh-server -p 2020:22 jdeathe/centos-ssh:centos-7 进入容器修改为允许使用用户名密码登录
# 进入容器 docker exec -ti ssh-server-1 bash # 修改配置 vi /etc/ssh/sshd_config # 将PasswordAuthentication的no改为yes # 查看sshd线程 ps aux | grep sshd # 刷新修改，即可用默认用户名跟密码登录 kill -1 ${pid}  通过docker logs ssh-server可以查看到, 默认用户名密码
	</div>
	<div class="list__footer clearfix">
		<a class="list__footer-readmore btn" href="/post/2018-09-23-linux%E7%94%A8%E6%88%B7%E7%9B%B8%E5%85%B3%E5%9F%BA%E7%A1%80/">Read more…</a>
	</div>
</article>
</main>


			</div>
			
<aside class="sidebar sidebar--left"><div class="widget-search widget">
	<form class="widget-search__form" role="search" method="get" action="https://google.com/search">
		<label>
			<input class="widget-search__field" type="search" placeholder="SEARCH..." value="" name="q" aria-label="SEARCH...">
		</label>
		<input class="widget-search__submit" type="submit" value="Search">
		<input type="hidden" name="sitesearch" value="/" />
	</form>
</div>
<div class="widget-recent widget">
	<h4 class="widget__title">Recent Posts</h4>
	<div class="widget__content">
		<ul class="widget__list">
			<li class="widget__item"><a class="widget__link" href="/post/2020-06-06-%E6%B8%B8%E6%88%8F/">游戏</a></li>
			<li class="widget__item"><a class="widget__link" href="/post/2020-05-28-mysql%E4%B8%BB%E4%BB%8E/">mysql主从</a></li>
			<li class="widget__item"><a class="widget__link" href="/post/2020-05-27-mysql%E6%89%A7%E8%A1%8C%E8%AE%A1%E5%88%92/">mysql执行计划</a></li>
		</ul>
	</div>
</div>
<div class="widget-categories widget">
	<h4 class="widget__title">Categories</h4>
	<div class="widget__content">
		<ul class="widget__list">
			<li class="widget__item"><a class="widget__link" href="/categories/bigdata">Bigdata</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/hadoop">Hadoop</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/install">Install</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/java">Java</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/linux">Linux</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/markdown">Markdown</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/monitor">Monitor</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/search">Search</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/tips">Tips</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/%e6%95%b0%e6%8d%ae%e5%ba%93">数据库</a></li>
			<li class="widget__item"><a class="widget__link" href="/categories/%e6%b8%b8%e6%88%8f">游戏</a></li>
		</ul>
	</div>
</div>
<div class="widget-taglist widget">
	<h4 class="widget__title">Tags</h4>
	<div class="widget__content">
		<a class="widget-taglist__link widget__link btn" href="/tags/awk" title="Awk">Awk (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/centos" title="Centos">Centos (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/github" title="Github">Github (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/google" title="Google">Google (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/hadoop" title="Hadoop">Hadoop (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/hdfs" title="Hdfs">Hdfs (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/hugo" title="Hugo">Hugo (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/java" title="Java">Java (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/jekyll" title="Jekyll">Jekyll (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/mongodb" title="Mongodb">Mongodb (3)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/mysql" title="Mysql">Mysql (4)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/spring" title="Spring">Spring (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/vim" title="Vim">Vim (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/yarn" title="Yarn">Yarn (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e4%bc%91%e9%97%b2" title="休闲">休闲 (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e5%b7%a5%e5%85%b7" title="工具">工具 (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e7%94%a8%e6%88%b7%e7%ae%a1%e7%90%86" title="用户管理">用户管理 (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e7%9b%91%e6%8e%a7" title="监控">监控 (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e8%b5%84%e6%96%99" title="资料">资料 (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e8%bd%ac%e5%8f%91" title="转发">转发 (1)</a>
		<a class="widget-taglist__link widget__link btn" href="/tags/%e8%bd%af%e4%bb%b6" title="软件">软件 (1)</a>
	</div>
</div>
<div class="widget-social widget">
	<h4 class="widget-social__title widget__title">Social</h4>
	<div class="widget-social__content widget__content">
		<div class="widget-social__item widget__item">
			<a class="widget-social__link widget__link btn" title="GitHub" rel="noopener noreferrer" href="https://github.com/chenjipdc" target="_blank">
				<svg class="widget-social__link-icon icon icon-github" width="24" height="24" viewBox="0 0 384 374"><path d="m192 0c-106.1 0-192 85.8-192 191.7 0 84.7 55 156.6 131.3 181.9 9.6 1.8 13.1-4.2 13.1-9.2 0-4.6-.2-16.6-.3-32.6-53.4 11.6-64.7-25.7-64.7-25.7-8.7-22.1-21.3-28-21.3-28-17.4-11.9 1.3-11.6 1.3-11.6 19.3 1.4 29.4 19.8 29.4 19.8 17.1 29.3 44.9 20.8 55.9 15.9 1.7-12.4 6.7-20.8 12.2-25.6-42.6-4.8-87.5-21.3-87.5-94.8 0-20.9 7.5-38 19.8-51.4-2-4.9-8.6-24.3 1.9-50.7 0 0 16.1-5.2 52.8 19.7 15.3-4.2 31.7-6.4 48.1-6.5 16.3.1 32.7 2.2 48.1 6.5 36.7-24.8 52.8-19.7 52.8-19.7 10.5 26.4 3.9 45.9 1.9 50.7 12.3 13.4 19.7 30.5 19.7 51.4 0 73.7-44.9 89.9-87.7 94.6 6.9 5.9 13 17.6 13 35.5 0 25.6-.2 46.3-.2 52.6 0 5.1 3.5 11.1 13.2 9.2 76.2-25.5 131.2-97.3 131.2-182 0-105.9-86-191.7-192-191.7z"/></svg>
				<span>GitHub</span>
			</a>
		</div>
		<div class="widget-social__item widget__item">
			<a class="widget-social__link widget__link btn" title="Email" href="mailto:chenjipdc@gmail.com">
				<svg class="widget-social__link-icon icon icon-mail" width="24" height="24" viewBox="0 0 416 288"><path d="m0 16v256 16h16 384 16v-16-256-16h-16-384-16zm347 16-139 92.5-139-92.5zm-148 125.5 9 5.5 9-5.5 167-111.5v210h-352v-210z"/></svg>
				<span>chenjipdc@gmail.com</span>
			</a>
		</div>
	</div>
</div>
</aside>
		</div>
		<footer class="footer">
	<div class="container footer__container flex">
		
		<div class="footer__copyright">
			&copy; 2020 pdc.
			<span class="footer__copyright-credits">Generated with <a href="https://gohugo.io/" rel="nofollow noopener" target="_blank">Hugo</a> and <a href="https://github.com/Vimux/Mainroad/" rel="nofollow noopener" target="_blank">Mainroad</a> theme.</span>
		</div>
	</div>
</footer>
	</div>
<script async defer src="/js/menu.js"></script></body>
</html>